package io.vanaheimr.account;

import io.micronaut.core.annotation.Introspected;
import io.vanaheimr.common.core.Status;
import io.vanaheimr.common.db.BaseEntity;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotBlank;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.util.List;

@Entity
@Getter
@Setter
@ToString(callSuper = true)
@Introspected
public class Account extends BaseEntity {

    @NotBlank
    private String name;

    private String phone;

    @NotBlank
    private String password;

    private String email;

    private String avatar;

    private String remark;

    private String salt;

    private Status status;


    @ManyToOne
    @JoinColumn(name = "group_id", foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))
    private Group group;

    @ManyToMany
    @JoinColumn(name = "role_id", foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))
    @ToString.Exclude
    private List<Role> roles;

}
